package main

import (
	"fmt"
	"net"
	"net/rpc"
	"net/rpc/jsonrpc"
)

func main5() {
	rpc.Register(new(UserHandler))

	listener, err := net.Listen("tcp", "127.0.0.1:8090")

	if err != nil {
		fmt.Println("监听TCP端口出错")
		return
	}

	for {
		conn, err := listener.Accept()
		if err != nil {
			fmt.Println("建立TCP连接失败")
			continue
		}

		go func(conn net.Conn) {
			jsonrpc.ServeConn(conn)
		}(conn)
	}
}
